from typing import *


class Solution:
    def minimumRounds(self, tasks: List[int]) -> int:
        ans = 0
        for k, v in Counter(tasks).items():
            if v == 1:
                return -1
            ans += v // 3 if v % 3 == 0 else v // 3 + 1
        return ans
